package com.utils.query;

import java.io.IOException;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.constants.Constants;

/**
 * @Author: liuss
 * @DateTime: 2024-12-28 18:11
 * @Description:
 */
public class QueryCityItem {
    private static final Logger LOG = LoggerFactory.getLogger(QueryCityItem.class);

    private QueryCityItem() {
        throw new IllegalStateException("Utility class");
    }

    /**
     * 方法和参数配置
     */
    private static JSONArray METHOD_JSON = new JSONArray();

    static {
        try {
            // 读配置文件
            String jsonStr = FileUtils.readTextFile(FileUtils.class.getClassLoader().getResourceAsStream("json/city.json"),
                    Constants.DEFAULT_CHARSET);
            LOG.debug(">>> 加载省市编码的参数信息：{}", jsonStr);
            METHOD_JSON = JSON.parseArray(jsonStr);
        } catch (IOException e) {
            LOG.error(">>> 加载省市编码的参数信息异常", e);
        }
    }

    public static JSONArray getMethodConfig() {
        return METHOD_JSON;
    }
}
